/*-------------------------------------------------------------------------
 *
 * pg_foreign_server.h
 *	  "外部服务器" 系统目录 (pg_foreign_server) 的定义
 *
 * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
 * Portions Copyright (c) 1994, Regents of the University of California
 *
 * src/include/catalog/pg_foreign_server.h
 *
 * NOTES
 *	  Catalog.pm 模块读取此文件并推导模式
 *	  信息。
 *
 *-------------------------------------------------------------------------
 */
#ifndef PG_FOREIGN_SERVER_H
#define PG_FOREIGN_SERVER_H

#include "catalog/genbki.h"
#include "catalog/pg_foreign_server_d.h"

/* ----------------
 *		pg_foreign_server 定义。 cpp 将其转换为
 *		typedef struct FormData_pg_foreign_server
 * ----------------
 */
CATALOG(pg_foreign_server,1417,ForeignServerRelationId)
{
	Oid			oid;			/* oid */
	NameData	srvname;		/* 外部服务器名称 */
	Oid			srvowner BKI_LOOKUP(pg_authid); /* 服务器所有者 */
	Oid			srvfdw BKI_LOOKUP(pg_foreign_data_wrapper); /* 服务器 FDW */

#ifdef CATALOG_VARLEN			/* 可变长度字段从这里开始 */
	text		srvtype;
	text		srvversion;
	aclitem		srvacl[1];		/* 访问权限 */
	text		srvoptions[1];	/* FDW 特定选项 */
#endif
} FormData_pg_foreign_server;

/* ----------------
 *		Form_pg_foreign_server 对应于指向具有 pg_foreign_server 关系格式的元组的指针。
 * ----------------
 */
typedef FormData_pg_foreign_server *Form_pg_foreign_server;

DECLARE_TOAST(pg_foreign_server, 4151, 4152);

DECLARE_UNIQUE_INDEX_PKEY(pg_foreign_server_oid_index, 113, ForeignServerOidIndexId, on pg_foreign_server using btree(oid oid_ops));
DECLARE_UNIQUE_INDEX(pg_foreign_server_name_index, 549, ForeignServerNameIndexId, on pg_foreign_server using btree(srvname name_ops));

#endif							/* PG_FOREIGN_SERVER_H */
